import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/common/homePage/index.vue'
import AdminHomeView from '@/views/admin/adminLogin.vue'
import FarmerLoginView from '@/views/farmer/FarmerLogin.vue'
import BuyerLoginView from '@/views/buyer/BuyerLogin.vue'
import BankLoginView from '@/views/bank/BankLogin.vue'
import ExpertLoginView from '@/views/expert/ExpertLogin.vue'
import FarmerIndex from '@/views/farmer/FarmerIndex.vue'
import CommunityLayoutView from '@/views/layout/communityLayout.vue'
import CommunityIndex from '@/views/community/index.vue'
import PrivateChat from '@/views/community/PrivateChat.vue'
import PostEditor from '@/views/community/PostEditor.vue'
import HotPosts from '@/views/community/HotPosts.vue'
import Notification from '@/views/community/notifications.vue'
import cropManagementLayout from '../views/layout/cropManagementLayout.vue'
import CropCategory from '../views/farmer/CropManage/CropCategory.vue'
import CropManagement from '../views/farmer/CropManage/CropManagement.vue'
import userSettingLayout from '../views/layout/userSettingLayout.vue'
import BasicInfo from '../views/farmer/UserSettings/BasicInfo.vue'
import SecuritySettings from '../views/farmer/UserSettings/SecuritySettings.vue'
import PrivacySettings from '../views/farmer/UserSettings/PrivacySettings.vue'
import financingServerLayout from '../views/layout/financingServerLayout.vue'
import FinancingProducts from '../views/farmer/FinancingServer/FinanceProducts.vue'
import MyApplications from '../views/farmer/FinancingServer/MyApplications.vue'
import DataAnalysis from '../views/farmer/dataAnalysis.vue'
import expertAssistanceLayout from '../views/layout/expertAssistanceLayout.vue'
import ExpertAppointment from '../views/farmer/ExpertAssistance/ExpertAppointment.vue'
import ExpertQA from '../views/farmer/ExpertAssistance/ExpertQ&A.vue'
import AppointmentRecord from '../views/farmer/ExpertAssistance/AppointmentRecords.vue'
import AgriculturalKnowledge from '../views/farmer/ExpertAssistance/AgriculturalKnowledge.vue'
import BuyerIndex from '@/views/buyer/BuyerIndex.vue'
import BuyerIndexLayout from '@/views/layout/buyerIndexLayout.vue'
import communityBuyerLayout from '../views/layout/communityBuyerLayout.vue'
import CommunityBuyerIndex from '@/views/community/index.vue'
import PrivateChatBuyer from '@/views/community/PrivateChat.vue'
import MyPost from '../views/community/MyPost.vue'
import HotPostsBuyer from '@/views/community/HotPosts.vue'
import NotificationBuyer from '@/views/community/notifications.vue'
import PayFor from '../views/buyer/PayFor.vue'
import ProfilePage from '../views/buyer/ProfilePage.vue'
import OrdersPage from '../views/buyer/OrdersPage.vue'
import ProductTrading from '../views/farmer/ProductManagement/ProductTrading.vue'
import productManagementLayout from '../views/layout/productManagementLayout.vue'
import ProductOrder from '../views/farmer/ProductManagement/ProductOrder.vue'
import BuyerDemandPage from '../views/buyer/BuyerDemandPage.vue'
import OrderRequirement from '../views/farmer/ProductManagement/OrderRequirement.vue'
import expertIndexLayout from '../views/layout/expertIndexLayout.vue'
import KnowledgeManagement from '../views/expert/KnowledgeManagement.vue'
import AppointmentManagement from '../views/expert/AppointmentManagement.vue'
import OnlineQA from '../views/expert/OnlineQA.vue'
import RecordsView from '../views/expert/RecordsView.vue'
import ProfileSettings from '../views/expert/ProfileSettings.vue'
import ExpertIndex from '../views/expert/index.vue'
import BankIndex from '../views/bank/index.vue'
import AdminLayoutView from '@/views/layout/adminLayout.vue'
import AdminIndex from '../views/admin/index.vue'
import MyPostBuyer from '../views/community/MyPost.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/farmer',
      name: 'farmerLogin',
      component: FarmerLoginView
    },
    {
      path: '/buyer',
      name: 'buyerLogin',
      component: BuyerLoginView
    },
    {
      path: '/bank',
      name: 'bankLogin',
      component: BankLoginView
    },
    {
      path: '/expert',
      name: 'expertLogin',
      component: ExpertLoginView
    },
    {
      path: '/admin',
      name: 'adminHome',
      component: AdminHomeView
    },
    {
      path: '/farmer/index',
      name: 'farmerIndex',
      component: FarmerIndex
    },
    {
      path: '/community/index',
      name: '',
      component: CommunityLayoutView,
      children: [
        { path: '/community/index', name: 'communityIndex', component: CommunityIndex },
        { path: '/community/chat', name: 'privateChat', component: PrivateChat },
        { path: '/community/myPost', name: 'myPost', component: MyPost },
        { path: '/community/hot', name: 'hotPosts', component: HotPosts },
        { path: '/community/notifications', name: 'notifications', component: Notification },
      ]
    },
    {
      path: '/cropManagement/category',
      name: '',
      component: cropManagementLayout,
      children: [
        { path: '/cropManagement/category', name: 'cropCategory', component: CropCategory },
        { path: '/cropManagement/management', name: 'cropManagement', component: CropManagement },
      ]
    },
    {
      path: '/farmer/settings/basicInfo',
      name: '',
      component: userSettingLayout,
      children: [
        { path: '/farmer/settings/basicInfo', name: 'basicInfo', component: BasicInfo },
        { path: '/farmer/settings/securitySettings', name: 'securitySettings', component: SecuritySettings },
        { path: '/farmer/settings/privacySettings', name: 'privacySettings', component: PrivacySettings },
      ]
    },
    {
      path: '/farmer/financingServer/financingProducts',
      name: '',
      component: financingServerLayout,
      children: [
        { path: '/farmer/financingServer/financingProducts', name: 'financingProducts', component: FinancingProducts },
        { path: '/farmer/financingServer/myApplications', name: 'myApplications', component: MyApplications },
      ]
    },
    {
      path: '/farmer/dataAnalysis',
      name: 'dataAnalysis',
      component: DataAnalysis
    },
    {
      path: '/farmer/expertAssistance/agriculturalKnowledge',
      name: '',
      component: expertAssistanceLayout,
      children: [
        { path: '/farmer/expertAssistance/appointment', name: 'expertAppointment', component: ExpertAppointment },
        { path: '/farmer/expertAssistance/qa', name: 'expertQA', component: ExpertQA },
        { path: '/farmer/expertAssistance/appointmentRecord', name: 'appointmentRecord', component: AppointmentRecord },
        { path: '/farmer/expertAssistance/agriculturalKnowledge', name: 'agriculturalKnowledge', component: AgriculturalKnowledge },
      ]
    },
    {
      path: '/farmer/productManagement/productTradingManagement',
      name: '',
      component: productManagementLayout,
      children: [
        { path: '/farmer/productManagement/productTrading', name: 'productTrading', component: ProductTrading },
        { path: '/farmer/productManagement/productOrder', name: 'productOrder', component: ProductOrder },
        { path: '/farmer/productManagement/orderRequirement', name: 'orderRequirement', component: OrderRequirement },
      ]
    },
    {
      path: '/buyer/index',
      name: '',
      component: BuyerIndexLayout,
      children: [
        { path: '/buyer/index', name: 'buyerIndex', component: BuyerIndex },
        { path: '/buyer/profile', name: 'profilePage', component: ProfilePage },
        { path: '/buyer/orders', name: 'ordersPage', component: OrdersPage },
        { path: '/buyer/buyerDemandPage', name: 'buyerDemandPage', component: BuyerDemandPage },
      ]
    },
    {
      path: '/community/buyer/index',
      name: '',
      component: communityBuyerLayout,
      children: [
        { path: '/community/buyer/index', name: 'communityBuyerIndex', component: CommunityBuyerIndex },
        { path: '/community/buyer/chat', name: 'privateChatBuyer', component: PrivateChatBuyer },
        { path: '/community/buyer/myPost', name: 'myPostBuyer', component: MyPostBuyer },
        { path: '/community/buyer/hot', name: 'hotPostsBuyer', component: HotPostsBuyer },
        { path: '/community/buyer/notifications', name: 'notificationsBuyer', component: NotificationBuyer },
      ]
    },
    {
      path: '/buyer/payFor',
      name: 'payFor',
      component: PayFor
    },
    {
      path: '/expert/index',
      name: '',
      component: expertIndexLayout,
      children: [
        { path: '/expert/index', name: 'expertIndex', component: ExpertIndex },
        { path: '/expert/knowledgeManagement', name: 'knowledgeManagement', component: KnowledgeManagement },
        { path: '/expert/appointmentManagement', name: 'appointmentManagement', component: AppointmentManagement },
        { path: '/expert/onlineQA', name: 'onlineQA', component: OnlineQA },
        { path: '/expert/recordsView', name: 'recordsView', component: RecordsView },
        { path: '/expert/profileSettings', name: 'profileSettings', component: ProfileSettings },
      ]
    },
    {
      path: '/bank/index',
      name: 'bankIndex',
      component: BankIndex
    },
    {
      path: '/admin/index',
      name: 'adminIndex',
      component: AdminLayoutView,
      children: [
        { path: '/admin/index', name: 'adminIndex', component: AdminIndex },
      ]
    },
  ]
})


export default router
